package sosopkpk;

import java.util.Scanner;

public class J09Account {

	public static void main(String[] args) {
		// 변수 선언
		int aid[] = new int[2];
		int balance[] = new int[4];
		double interestRate[] = new double[2];
		String dateCreated[] = new String[2];
		double monthlyInterestRate[] = new double[2];
		int withdraw[] = new int[2];
		int deposit[] = new int[2];
		String result = "";

		// 입력
		inputAccount(aid, balance, interestRate, dateCreated, withdraw, deposit);
		// 월간 이자율
		getMonthlyInterestRate(monthlyInterestRate, interestRate);
		// 인출
		withDraw(withdraw, balance);
		// 예금
		deposit(deposit, balance);

		// 결과 출력
		result += "계좌번호 : " + aid[1] + "\n" + "기존 통장 잔액 : " + balance[1] + "\n"
				+ "연간 이자율 : " + interestRate[1] + "\n" + "통장 개설날짜 : "
				+ dateCreated[1] + "\n" + "월간 이자율 : " + monthlyInterestRate[1]
				+ "\n" + "인출 후 통장잔액 : " + balance[2] + "\n" + "예금 후 통장잔액 : "
				+ balance[3] + "\n";
		System.out.println(result);

	} // main

	// 계좌번호, 통장잔액, 연간 이자율 입력
	public static void inputAccount(int[] aid, int[] balance,
			double[] interestRate, String[] dateCreated, int[] withdraw,
			int[] deposit) {
		Scanner sc = new Scanner(System.in);
		System.out.println("계좌번호는?");
		aid[1] = sc.nextInt();
		System.out.println("통장잔액은?");
		balance[1] = sc.nextInt();
		System.out.println("연간 이자율은?");
		interestRate[1] = sc.nextDouble();
		System.out.println("통장 개설날짜는?");
		dateCreated[1] = sc.next();
		System.out.println("인출할 금액은?");
		withdraw[1] = sc.nextInt();
		System.out.println("예금할 금액은?");
		deposit[1] = sc.nextInt();
		sc.close();
	} // inputAccount

	// 월간 이자율 계산
	public static void getMonthlyInterestRate(double[] monthlyInterestRate,
			double[] interestRate) {
		monthlyInterestRate[1] = interestRate[1] / 12;
	} // getMonthlyInterestRate

	// 주어진 액수만큼 예금을 인출 계산
	public static void withDraw(int[] withdraw, int[] balance) {
		balance[2] = balance[1] - withdraw[1];
	} // withDraw

	// 주어진 액수만큼 예금 계산
	public static void deposit(int[] deposit, int[] balance) {
		balance[3] = balance[2] + deposit[1];
	} // deposit

} // class
